// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 根据分类id获取菜品集合 GET /items/categoryId */
export async function listByCategoryId(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.listByCategoryIdParams,
  options?: { [key: string]: any },
) {
  return request<API.CommonResultListItem>('/api/items/categoryId', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 新增菜品 POST /items/create */
export async function saveItem(body: API.Item, options?: { [key: string]: any }) {
  return request<any>('/items/create', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据id删除菜品 DELETE /items/delete */
export async function deleteItemById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteItemByIdParams,
  options?: { [key: string]: any },
) {
  return request<any>('/items/delete', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 批量删除菜品 DELETE /items/deletes */
export async function deleteItemByIds(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteItemByIdsParams,
  options?: { [key: string]: any },
) {
  return request<any>('/items/deletes', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 根据id查询菜品 GET /items/get */
export async function queryItemById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.queryItemByIdParams,
  options?: { [key: string]: any },
) {
  return request<API.CommonResultItem>('/items/get', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 根据id批量查询菜品 GET /items/gets */
export async function queryItemByIds(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.queryItemByIdsParams,
  options?: { [key: string]: any },
) {
  return request<API.CommonResultListItem>('/items/gets', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 分页查询菜品 POST /items/list */
export async function queryItemByPage(body: API.ItemPageQuery, options?: { [key: string]: any }) {
  return request<API.PageResponseItemPageReqVO>('/api/items/list', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新菜品状态 PUT /items/status/${param0}/${param1} */
export async function updateItemStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateItemStatusParams,
  options?: { [key: string]: any },
) {
  const { id: param0, status: param1, ...queryParams } = params;
  return request<any>(`/items/status/${param0}/${param1}`, {
    method: 'PUT',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新菜品 PUT /items/update */
export async function updateItem(body: API.Item, options?: { [key: string]: any }) {
  return request<any>('/items/update', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
